package com.swlz.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.swlz.entity.MallProduct;
import com.swlz.entity.MallType;
import com.swlz.service.MallProductService;
import com.swlz.service.MallTypeService;
import com.swlz.service.impl.MallProductServiceImpl;
import com.swlz.service.impl.MallTypeServiceImpl;


@WebServlet("/show.let")
public class ShowServlet extends HttpServlet {
	private MallProductService mallProductService = new MallProductServiceImpl();
	private MallTypeService mallTypeService = new MallTypeServiceImpl();
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			Long productId = Long.valueOf(request.getParameter("productId"));		
			MallProduct vo = mallProductService.get(productId);
			MallType type = mallTypeService.get(vo.getMallTypeId());
			request.setAttribute("vo", vo);
			request.setAttribute("type", type);
			request.getRequestDispatcher("user/show.jsp").forward(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
